
OBJS_BOOTPACK = bootpack.obj naskfunc.obj hankaku.obj graphic.obj dsctbl.obj int.obj dtstruct.obj iodev.obj memory.obj sheet.obj timer.obj multask.obj cmd.obj \
file.obj pict.obj bmp.obj jpeg.obj



TOOLPATH = ../../z_tools/
INCPATH  = ../../z_tools/haribote/

MAKE     = $(TOOLPATH)make.exe -r
NASK     = $(TOOLPATH)nask.exe
EDIMG    = $(TOOLPATH)edimg.exe
IMGTOL   = $(TOOLPATH)imgtol.com

COPY     = copy
DEL      = del

#编译c语言
CC1      = $(TOOLPATH)cc1.exe -I$(INCPATH) -Os -Wall -quiet
GAS2NASK = $(TOOLPATH)gas2nask.exe -a
OBJ2BIM  = $(TOOLPATH)obj2bim.exe
BIM2HRB  = $(TOOLPATH)bim2hrb.exe
RULEFILE = ../os.rul

#编译字体用到
MAKEFONT = $(TOOLPATH)makefont.exe
BIN2OBJ  = $(TOOLPATH)bin2obj.exe




default:
	$(MAKE) ipl20.bin
	$(MAKE) os.sys

ipl20.bin: ipl20.nas Makefile
	 $(NASK) ipl20.nas ipl20.bin ipl20.lst


os.sys: asmhead.bin bootpack.hrb Makefile
	copy /B asmhead.bin+bootpack.hrb os.sys



asmhead.bin:
	$(NASK) asmhead.nas asmhead.bin asmhead.lst


bootpack.bim: $(OBJS_BOOTPACK) ../include/apilib.lib  Makefile
	$(OBJ2BIM) @$(RULEFILE) out:bootpack.bim stack:3136k map:bootpack.map \
		$(OBJS_BOOTPACK) ../include/apilib.lib
# 3MB+64KB=3136KB

bootpack.hrb: bootpack.bim Makefile
	$(BIM2HRB) bootpack.bim bootpack.hrb 0




hankaku.bin: hankaku.txt Makefile
	$(MAKEFONT) hankaku.txt hankaku.bin

hankaku.obj: hankaku.bin Makefile
	$(BIN2OBJ) hankaku.bin hankaku.obj _hankaku

#编译C程序为hrb格式
#一般规则

%.gas: %.c Makefile
	$(CC1) -o $*.gas $*.c
%.nas: %.gas Makefile
	$(GAS2NASK) $*.gas $*.nas
%.obj: %.nas Makefile
	$(NASK) $*.nas $*.obj $*.lst				




cl: 
	-$(DEL) *.bin
	-$(DEL) *.lst
#-$(DEL) os.sys

	-$(DEL) *.bim
#	-$(DEL) *.gas
	-$(DEL) *.hrb
	-$(DEL) *.map
#	-$(DEL) *.obj

	-$(DEL) os.sys 
#	-$(DEL) os.img	

	-$(DEL)	timer.obj
	-$(DEL)	sheet.obj
	-$(DEL) naskfunc.obj
	-$(DEL) multask.obj
	-$(DEL) memory.obj
	-$(DEL) jpeg.obj
	-$(DEL) iodev.obj
	-$(DEL) int.obj
	-$(DEL) hankaku.obj
	-$(DEL) graphic.obj
	-$(DEL) file.obj
	-$(DEL) dtstruct.obj
	-$(DEL) dsctbl.obj
	-$(DEL) cmd.obj
	-$(DEL) bootpack.obj


